package org.cs.computer;

import org.cs.mainmemorymachine.MainMemoryMachine;

/**
 * 内存
 *
 * @author fbin
 * @since 2022/4/5 13:35
 */
public class InnerMemory {
    private static final MainMemoryMachine MAIN_MEMORY_MACHINE;

    static {
        MAIN_MEMORY_MACHINE = new MainMemoryMachine();
    }

    /**
     * 读数据
     *
     * @param address 地址
     * @return 数据
     */
    public Object read(int address) {
        return MAIN_MEMORY_MACHINE.read(address);
    }

    /**
     * 写数据
     *
     * @param address 地址
     * @param data 数据
     */
    public void write(int address, Object data) {
        MAIN_MEMORY_MACHINE.write(address, data);
    }
}
